package com.changpay.zywy.adapter

import android.content.Context
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.changpay.zywy.R
import com.changpay.zywy.bean.ApplyDetailBean

/**
 * Created by chenxz on 2018/4/22.
 */
class ApplyDetailAdapter(private val context: Context?, datas: MutableList<ApplyDetailBean.DataBean>) :
    BaseQuickAdapter<ApplyDetailBean.DataBean, BaseViewHolder>(R.layout.item_apply_detail, datas) {

    override fun convert(helper: BaseViewHolder?, item: ApplyDetailBean.DataBean?) {
        item ?: return
        helper ?: return

        helper.setText(R.id.tv_title, item.title)
            .setText(R.id.tv_time, item.create_time)
            .setText(R.id.tv_content, item.goods_name + item.goods_serial)
            .setText(R.id.tv_member_name, item.member_name)
            .setText(R.id.tv_member_id, item.member_id.toString())
        when (item.examine_type) {
            "0", "1", "4", "5" -> {helper.setText(R.id.tv_type, "待审核")
                helper.setBackgroundRes(R.id.tv_type, R.mipmap.icon_commit_wait)
            }
            "2" -> {helper.setText(R.id.tv_type, "审核通过")
                helper.setBackgroundRes(R.id.tv_type, R.mipmap.icon_commit_all)
            }
            "3" -> {helper.setText(R.id.tv_type, "审核失败")
                helper.setBackgroundRes(R.id.tv_type, R.mipmap.icon_commit_ref)
            }
        }
    }

}
